# $Id: populatedb.tcl 44 2007-09-03 00:47:25Z khomoutov $
# Test scripts that (re)creates files database with one share
# rooted at specified directory and populates that share.

lappend auto_path tcldc
package require dcshare
namespace import ::dcshare::*

if {$argc == 1} {
	set dir [lindex $argv 0]
} else {
	set dir c:/opt
	#set dir c:/shared
	#set dir c:/shared/Penumbra
}
if {![info exists dir]} {
	error "Directory to scan is not specified"
}

file delete ./scratch.db
database open ./scratch.db
if {![share exists dummy]} {
	share create dummy $dir
}

set start [clock seconds]
share populate dummy
set end [clock seconds]
puts "[expr $end-$start] seconds"

database close

